let routerTitle = "";
let sideTitle = "";

function setTitle() {
    if(!routerTitle && !sideTitle) {
        document.title = "loading...";
    } else if(!routerTitle && sideTitle) {
        document.title = sideTitle;
    } else if(routerTitle && !sideTitle) {
        document.title = routerTitle;
    } else {
        document.title = `${routerTitle}-${sideTitle}`;
    }
}

export default {
    setRouterTitle(title) {
        routerTitle = title;
        setTitle();
    },
    setSideTitle(title) {
        sideTitle = title
        setTitle();
    }
}
